import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'
// 新增：正确导入组件
import FormPage from '../components/index.vue';
import FormDetail from '../components/FormDetail.vue';
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  // 新增表单页面路由
  {
    path: '/form',
    name: 'FormPage',
    //component: () => import('../components/index.vue')
    component: FormPage,
    children: [
      {
        path: '/formDetail',
        name: 'FormDetail',
        component: FormDetail
      }
    ]
  },
  // {
  //   path: '/formDetail',
  //   name: 'FormDetail',
  //   component: FormDetail
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
